﻿@using Reader.Core.Application.Models
@model Reader.Core.Application.Result<List<AllBookModel>>

@if (Model.Success)
{
    <div class="tab-content">
        <div class="block-area tab-pane active" style="height:100%;width:100%">
            <ul class="book-list">
                @foreach (var it in Model.Data)
                {
                    <li class="pover" data-placement="bottom" data-trigger="hover" data-toggle="popover" title="" data-content="@it.Intro" data-original-title="">
                        <div class="panel panel-default tile">
                            <div class="panel-heading">
                                <h6 class="panel-title">
                                    @it.Name
                                    <small class="s-text pull-right">@it.AuthorName</small>
                                </h6>
                            </div>
                            <div class="panel-body">
                                @if (it.Download)
                                {
                                    <a href="#" onclick="parent.tab.addTab({ title: '@it.Name', content: '@it.Url', type: 'frame' })"><img src="@it.Cover"></a>
                                }
                                else
                                {
                                    <a href="#"></a>
                                }
                                <button type="button" class="btn btn-sm operator dropdown-toggle" data-toggle="dropdown">操作</button>
                                <ul class="dropdown-menu dropdown-menu-alt">
                                    @if (!it.Completed)
                                    {
                                    <li><a href="#" onclick="update(@it.Id)">更新</a></li>
                                    }
                                    <li><a href="#" onclick="downloadForce(@it.Id)">重新下载</a></li>
                                    <li><a href="#" onclick="del(@it.Id)">删除</a></li>
                                    <li><hr /></li>
                                    <li><a href="#" onclick="downloadFile(@it.Id)">导出Txt</a></li>
                                </ul>
                            </div>
                            <div class="panel-footer">
                                <a href="#" onclick="parent.tab.addTab({ title: '@it.SiteName', content: '@it.SiteUrl', type:'frame' })">@it.SiteName</a>
                            </div>
                        </div>
                    </li>
            }
            </ul>
        </div>
    </div>
}

@section styles{ 
    <environment include="Development">
        <link rel="stylesheet" href="~/css/frame/main.css" />
    </environment>
    <environment exclude="Development">
        <link rel="stylesheet" href="~/css/frame/main.min.css" />
    </environment>
}

@section scripts{ 
    <environment include="Development">
        <script src="~/js/frame/main.js"></script>
    </environment>
    <environment exclude="Development">
        <script src="~/js/frame/main.js"></script>
    </environment>
}